package vip.xiaonuo.smzq.modular.kcl.controller;

import javax.annotation.Resource;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import vip.xiaonuo.smzq.modular.kcl.entity.Cltj;
import vip.xiaonuo.smzq.modular.kcl.service.ICltjService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import vip.xiaonuo.common.pojo.CommonResult;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;


/**
 * 储量统计	
 *
 * @author eomer
 * @since 2024-02-22
 */
@Api(tags = "储量统计	")
@RestController
@RequestMapping("/kcl/cltj")
@Validated
public class CltjController {

    @Resource
    private ICltjService iCltjService;

    /**
     * 添加储量统计	
     */
    @ApiOperation("添加储量统计	")
    @PostMapping("/add")
    public CommonResult<String> add(@RequestBody @Valid Cltj cltj) {
        iCltjService.save(cltj);
        return CommonResult.ok();
    }

    /**
     * 删除储量统计	
     */
    @ApiOperation("删除储量统计	")
    @PostMapping("/delete")
    public CommonResult<String> delete(@ApiParam(name = "pkid", value = "主键") @RequestParam String pkid) {
        iCltjService.removeById(pkid);
        return CommonResult.ok();
    }

    /**
     * 编辑储量统计	
     */
    @ApiOperation("编辑储量统计	")
    @PostMapping("/edit")
    public CommonResult<String> edit(@RequestBody @Valid Cltj cltj) {
        iCltjService.updateById(cltj);
        return CommonResult.ok();
    }

    /**
     * 储量统计	分页查询
     */
    @ApiOperation("储量统计	分页查询")
    @GetMapping("/list")
    public CommonResult<Page<Cltj>> page() {
        return CommonResult.data(iCltjService.page(new Cltj()));
    }
}
